﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace UnitTestProject1
{
    [TestClass]
    public class TestThread
    {

        [TestMethod]
        public void Test()
        {
            //Thread thr = new Thread(DoTest);
            //thr.Start();
            //Thread.CurrentThread.Join(1000);
            //thr.Suspend
            Task task = Task.Run(() => DoTest());
            Task.Delay(1000);
            Assert.IsTrue(task.Status.HasFlag(TaskStatus.Running));
            Assert.AreEqual(false, task.IsCompleted);
            Assert.AreEqual(false, task.IsCanceled);
            Assert.AreEqual(false, task.IsFaulted);
            task.Wait();
        }
        ThreadState State = ThreadState.Running;
        void DoTest()
        {
            int i = 0;
            while(i>=0)
            {
                i++;
                i--;
            }
        }

        
    }
}
